package m.store.service;

import m.common.model.util.ModelUpdateUtil;
import m.common.service.Service;
import m.store.model.StoreGoods;
import m.store.model.StoreGoodsHistory;
import m.system.exception.MException;
import m.system.util.GenerateID;

import java.util.Date;

public class StoreGoodsHistoryService extends Service {
    /**
     * 保存历史记录
     */
    public void save(StoreGoods goods) throws MException {
        StoreGoodsHistory model=new StoreGoodsHistory();
        model.setOid(GenerateID.generatePrimaryKey());
        model.setGoods(goods);
        model.setTypeName(goods.getTypeName());
        model.setFactoryName(goods.getFactoryName());
        model.setName(goods.getName());
        model.setAttrJson(goods.getAttrJson());
        model.setEndDate(new Date());
        ModelUpdateUtil.insertModel(model);
    }
}
